<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>layout 后台大布局 - Layui</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <i th:replace="~{common :: baseUrl}"></i>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">

    <!--    头部-->
    <i th:replace="~{common :: head}"></i>
    <!--左侧-->
    <div class="layui-side-scroll">
        <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
        <ul class="layui-nav layui-nav-tree"  lay-filter="test">
            <!--            layui-nav-itemed  默认展开列表-->
            <li class="layui-nav-item ">
                <a class="javascript:;" href="javascript:;"><i class="layui-icon layui-icon-rate-solid"></i>  菜品</a>
                <dl class="layui-nav-child">
                    <dd ><a th:href="@{/food/category/index}">• 菜品类别</a></dd>
                    <dd > <a th:href="@{/food/record/index}">• 菜品档案</a></dd>
                    <dd ><a th:href="@{/food/taste/index}">• 菜品口味</a></dd>
                    <dd><a th:href="@{/food/specification/index}">• 规格管理</a></dd>
                    <dd><a th:href="@{/food/material/index}">• 原料管理</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item ">
                <a class="" href="javascript:;"><i class="layui-icon layui-icon-template-1"></i>  库存</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/inventory/record/index}">• 菜品库存</a></dd>
                    <dd><a th:href="@{/inventory/material/index}">• 原料库存</a></dd>
                    <dd><a th:href="@{/purchase/orders/index}">• 采购单</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item ">
                <a class="" href="javascript:;"><i class="layui-icon layui-icon-form"></i>  报表</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/statement/orders/index}">• 订单报表</a></dd>
                    <dd><a th:href="@{/statement/record/index}">• 菜品流水</a></dd>
                    <dd><a th:href="@{/statement/recordValue/index}">• 菜品销量</a></dd>
                    <dd><a th:href="@{/statement/daily/index}">• 经营日报</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item layui-nav-itemed">
                <a class="" href="javascript:;"><i class="layui-icon layui-icon-rmb"></i>  促销</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/promotion/specialOffer/index}">• 特价折扣</a></dd>
                    <dd><a th:href="@{/promotion/mealHot/index}">• 套餐热卖</a></dd>
                    <dd class="layui-this"><a th:href="@{/promotion/now/index}">• 当前促销</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item ">
                <a class="" href="javascript:;"><i class="layui-icon layui-icon-username"></i>  会员</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/member/category/index}">• 会员类别</a></dd>
                    <dd><a th:href="@{/member/set/index}">• 会员设置</a></dd>
                    <dd><a th:href="@{/member/manage/index}">• 会员管理</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;"><i class="layui-icon layui-icon-auz"></i>  门店</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/shop/assistant/index}">• 店员管理</a></dd>
                    <dd><a th:href="@{/shop/table/index}">• 桌位管理</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;"><i class="layui-icon layui-icon-set-fill"></i>  设置</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/set/pay/index}">• 支付设置</a></dd>
                    <dd><a th:href="@{/merchants/information/index}">• 商户资料</a></dd>
                </dl>
            </li>
        </ul>
    </div>



    <div class="layui-body layui-bg-gray">
        <!-- 内容主体区域 -->
        <div style="background-color:white; width: 100%;height: 5%;padding-left: 130px;padding-top: 5px" >
        <span class="layui-breadcrumb" >
            <a href="" style="font-size: 20px">促销</a>
             <a href="" style="font-size: 20px">当前促销</a>
        </span>
        </div>

        <!--正文-->
        <div style="background-color:white; width: 90%; height: 90%;margin-top: 1%;margin-left: 4%;padding-top: 1%;padding-left: 1%;padding-right: 1%">

            <!--查询条件-->
            <div>
                <form class="layui-form" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">

                            <div class="layui-input-inline">
                                <select id="merchantsId" lay-verify="required" lay-search="">
                                    <option value="">店铺名称</option>
                                    <option value="0">全部</option>
                                    <option th:each="l : ${merchantsInformationList}" th:value="${l.id}" th:text="${l.name}">无</option>
                                </select>

                            </div>
                        </div>

                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input type="text" id="recordNameOrPromotionName"  placeholder="请输入促销名称、菜品名称" class="layui-input">
                            </div>
                        </div>

                        <button type="button" class="layui-btn layui-btn-normal" id="selectBut">查询</button>
                    </div>
                    <div class="layui-form-item">

                        <div class="layui-input-block"style="margin-left: 0px;">
                            <input type="radio" lay-filter="status" name="status" value="0" title="全部促销" checked >
                            <input type="radio" lay-filter="status" name="status" value="1" title="今日促销" >
                            <input type="radio" lay-filter="status" name="status" value="2" title="明日促销">
                            <input type="radio" lay-filter="status" name="status" value="3" title="本周促销" >
                            <input type="radio" lay-filter="status" name="status" value="4" title="本月促销" >
                            <input type="radio" lay-filter="status" name="status" value="5" title="本年促销" >
                            <input type="radio" lay-filter="status" name="status" value="6" title="已结束促销" >
                        </div>
                    </div>
                </form>
            </div>
            <!--展示数据-->
            <div>

                <table class="layui-hide" id="now" lay-filter="now" align="center"></table>


            </div>
        </div>


    </div>



    <!--底部-->
    <i th:replace="~{common :: footer}"></i>
</div>
<script th:src="@{/layui/layui.js}"></script>
<script th:inline="none">
    //JavaScript代码区域
    layui.use(['element','table','form'], function(){
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.$;

        $("#img1").attr("src",$("#headPortrait")[0].innerText)

        //表格初始化
        table.render({
            elem: '#now'
            ,url:baseUrl+'promotion/now/list'
            ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            ,width: 1300
            ,toolbar: '#toolbarDemo'
            ,cols: [[

                {field:'merchantsName', width:100, title: '促销门店'}
                ,{field:'promotionName', width:100, title: '促销名称'}
                ,{field:'recordName', width:100, title: '菜品名称'}
                ,{field:'promotionPattern', width:100, title: '促销模式'}
                ,{field:'promotionScope', width:100, title: '活动范围'}
                ,{field:'originalPriceString', width:100, title: '原价' }
                ,{field:'specialPriceString', width:130, title: '特价/折扣价' }
                ,{field:'periodString', width:150, title: '每周生效' }
                ,{field:'startDate', width:200, title: '开始日期' }
                ,{field:'endDate', width:200, title: '结束日期' }
            ]]
            ,skin: 'row' //行边框风格
            ,even: true //开启隔行背景
            ,page: true
            ,where: {
                merchantsId:$("#merchantsId").val(),
                recordNameOrPromotionName:$("#recordNameOrPromotionName").val(),
                status: $('input:radio:checked').val()

    } //设定异步数据接口的额外参数

        });


        form.on('radio(status)', function(data){
            table.reload('now', {
                url: baseUrl+'promotion/now/list'
                ,where: {
                    status: data.value
                } //设定异步数据接口的额外参数

            });
        });

        //查询指定条件
        $("#selectBut").click(function () {

            table.reload('now', {
                url: baseUrl+'promotion/now/list'
                ,where: {
                    merchantsId:$("#merchantsId").val(),
                    recordNameOrPromotionName:$("#recordNameOrPromotionName").val(),
                    status: $('input:radio:checked').val()
                } //设定异步数据接口的额外参数

            });


        });









    });
</script>

</body>
</html>
